Services

In this section, user learns how to add, record a new service and manage the added services. There are two ways of creating a new virtual service.

This section covers recording of HTTP based service. Most of the steps are common for all protocols.

Recording a Service

Here, we have mentioned the pre-requisites and steps for recording a new service.

Prerequisites

  • Web service is an existing service and is available for recording.
  • Application is configured to interact with back-end services at controller service end point IP address and the port to be used for recording.
  • There are no firewall restrictions between Application and Controller and Controller and Backend servers to be used for recording.
  • There are no other processes in appliance using the IP/port to be used by recorder.

Following diagram displays the setup for recording a service:

  • Service Virtualization Recorder: Process by which request and response are recorded.
  • Service Repository: It is directory or repository, which contains all the virtualized services.

Recording Configurations

Before recording a service, user need to perform some configurations based on the recording mode. Follow the below mentioned steps for recording configurations:

  1. On the Services menu, click the Record Services menu item.
Figure 30: Record Service Option

2. The Service Recording window is displayed with following recording modes – HTTP Recording, JDBC Recording, and Socket Recording as shown in below figure.

Figure 31: Service Recording

Note: When user try to record a service/page, and if the recorder is already running in the background, a pop up dialog box with a message is displayed – “Recorder is already running. Do you want to stop the recorder and start recording?”. You can stop the recorder from there and start a new recording.

In the subsequent sections, the recording configurations of each recording mode is described. Let’s start with HTTP Recording first.

HTTP Recording Configurations

In the Recording Type section, there are two options for recording: Web Service Recording and Web Page Recording.

  1. Web Service Recording Configurations

For Web Service Recording in HTTP configuration, first select HTTP Recording from the Recording Mode drop-down as shown in Figure 31. After that from the Recording type drop-down select Web Service Recording as shown in the figure below.

Figure 32: HTTP Recording Configuration

Provide the following details in the fields for configuration:

  • Name: Name of the recording for reference purpose. User is required to provide the recording name that work as a prefix while creating a service through recording.

Example: Recorded Service name: ‘shoppingCart’

Prefix by user: ‘cavisson_’

Service name added in record: ‘cavisson_shoppingCart’

  • Port: Port on which incoming request comes. Here, a dropdown list is provided for recording port. User may provide either own recording port or select some port from the provided dropdown list.
  • Request URL Filter: This is used to specify URL filter if user need to send different URLs on same recorder port to different backend servers. In most cases, it is * to indicate all URLs.
  • Protocol: This is used to specify protocol of recording whether it is HTTP or HTTPS.
  • Service Endpoint hostname/IP: Hostname or IP address of the backend server or endpoint server is the server from where the response is captured to Service Virtualization.
  • Service Endpoint Port: Port number of the backend server port on which the application is running.
  • Client Certificate: A Client certificate is a variant of a digital certificate that is widely used by the client to make the systems authenticated so that trusted requests should go to a remote server. This certificate plays a crucial role in several joined authentication design, which offers a well-built guarantee of a requester’s identity.
  • Endpoint Certificate: Endpoint certificate are very small data files that digitally combine or join a cryptographic key to the company’s details and information. When SSL is installed on a web server, it triggers the security device and the https protocol (over port 443) allowing locked and safe connections from a web server to a browser.
  • Action: Action column gives user the option to add the service for which the details have been provided.

Note: At the time of service recording, user can use all the special characters (in service endpoint host name) except Hash (#) and space as these are special type of characters used in URI and it can only be read by client (browser). The server cannot use # in URI.

 

  1. Web Page Recording Configurations

For Web Page Recording in HTTP configuration, first select HTTP Recording from the Recording Mode drop down as shown in Figure 31. After that from the Recording type drop down select Web Page Recording as shown in figure below.

Figure 33: Web Page Recording

Provide the following details in the fields for configuration:

  • Name: Name of the recording for reference purpose.
  • Port: Port on which incoming request comes. Here, a dropdown list is provided for recording port. User may provide either own recording port or select some port from the provided dropdown list.
  • Request URL Filter: This is used to specify URL filter if user need to send different URLs on same recorder port to different backend servers. In most cases, it is * to indicate all URLs.
  • Action: Action column gives the option to add the service for which the details have been provided.

JDBC Recording Configurations

Java Database Connectivity (JDBC) is an application-programming interface (API) for the programming language Java, which defines how a client may access a database. It is a Java-based data access technology used for Java database connectivity. User can perform JDBC recording and can virtualize the database services.

To access JDBC Recording Configuration select JDBC Recording from the Recording Mode drop down as shown in Figure 31. On selection, JDBC Configuration option opens as shown in below figure.

Figure 34: JDBC Configuration

Provide the following details for the JDBC Configuration:

  • Connection ID: Select the Database Name.
  • JDBC Driver: It is a software component enabling a Java application to interact with a database.
  • Connection String: Enter the IP/Port.
  • Login Credentials: Enter the Username and Password.

Socket Recording Configurations

User can record the generic data coming on TCP socket as configured and send it to the server. To record generic TCP services in Service Virtualization, a recorder is created which acts as a proxy.

To access Socket Recording Configuration, select Socket Recording from the Recording Mode drop down as shown in Figure 31. Enter On selection, Socket Configuration option opens as shown in below figure.

Figure 35: Socket Configuration

Provide the following details:

  • Name: Provide the recording name. It is used to provide the prefix for the service name. It has the same functionality like in the previous recordings. Example: If user provide any Recording Name Demo, all the service name concerning this configuration is saved as Demo_ServiceName.
  • Port: The port on which user want to record. This displays the list of the defined port range. User can select any port from the list, or mention any port manually that any other processes are not using.
  • Protocol: Select the protocol from the list. It can be either SSL (secure) or NON-SSL (non-secure).

Note: User can enter a custom port while creating recorded services. If user keep it blank, the default endpoint port is fetched. Default SSL port is 443 and Non-SSL port is 80.

  • Service Endpoint Hostname/IP: Configure the service endpoint host name and IP.
  • Service Endpoint Port: Enter the Service Endpoint Port. For now, SSL port is 443 and Non SSL port is 80, but user can specify this port according to configuration.

SSL Settings: This option is enabled only if user select the SSL protocol. User can upload the certificate (client certificate and endpoint certificate) by clicking the   button.

Figure 36: SSL Setting
Figure 37: Upload Certificate

Advanced Settings: User can configure the advance settings for the TCP. The advance settings can be done for request and response both. On clicking the  button, the Advance Settings window is displayed.

Figure 38: Advance Settings

Message Boundary Policy

Message Boundary Policy tells the recorder when to consider the end of the message. Lets understand them in detail.

  1. Messages are of fixed length of bytes: End of the message is considered at specified bytes so data reading is done till specified bytes.
  2. Messages are delaminated by specified character: End of the message is considered when recorder finds the specified delaminate. A specific character or sequence of character, such as pipe or comma, indicates end of the message. The entire sequence must be matched. The delimiter itself is not included in the message. Following condition must be kept in mind:
  • Reading of data is stopped if a suffix message is found.
  • Max Delimiter length can be 64 bytes.
  1. Messages are delimited by end-of-data (complete TCP segment): End of the message is considered after reading single segment.
  2. Messages are complete if any part of the message contains specified characters: End of the message is considered when specified character is found.
  3. Messages are prefixed by message length in format of byte: End of message is considered as per the specified prefix length. Prefix type can be text or binary. For text type, prefix length can be 1 to 9 bytes while for binary type, prefix length can be 1,2,4,8 bytes.
  4. Messages are complete after connection is closed: End of the message is considered at connection close so data reading is stopped as connection gest closed.
  5. Message is complete after idle timeout is reached: End of message is considered when timeout is reached. It is not applicable for UDP protocol.

Message Format

It has the following decode types

  • Plain text
  • Binary to Hexadecimal
  • Binary to Base64
Figure 39: Message Format

Note:

  • The policy and timeout settings are available for both request and response. To have the same policy and settings at response end, select the Same As Request check box.
  • Once User are done with advance setting, they can save this configuration in UI. This is displayed in tabular format.
  • User can provide multiple configurations for different recording name, host name, and port as shown in below figure.
Figure 40: Multiple Configuration

Timeout Settings (ms)

Provide the values for the following timeout options as shown in Figure 41 :

  • First Byte Receive Timeout
    • It waits for the first request.
    • Connection is closed if this timeout occurs.
  • Idle Timeout
    • It is a delay between two conjugative reads. 
    • It resets on every read. 
    • Connection is closed if end policy is not timeout and timeout occurs else process data and start reading again.
  • Max Receive Timeout
    • It is max read timeout.
    • It resets on every read.
    • Connection is closed if end policy is not timeout and timeout occurs else process data and start reading again.
Figure 41: Timeout Settings

Http Recording

Web Service Recording

Let’s take an example of Web service recording where the recording mode is HTTP Recording.

  1. Select Web Service Recording option from the Recording Type drop down.
Figure 42: Web Service Recording Option
  1. Provide the required details in the fields, such as recording name, recording port, protocols, service endpoint hostname/IP, service endpoint port, client certificate (optional), and endpoint certificate (option)and click Add. (For details of the fields, refer to HTTP Recording Configurations in above section)
  2. Click the Start Recording button to start the recording. A pop up message as shown in below figure for successful recording starts appears at the top of the page.
Figure 43: Start Recording Message

4. Click OK. The following window is displayed where recorded requests and response requests are displayed as ‘0’ initially.

Figure 44: Start Recording Message

5. Open the URL in the browser, which is mentioned in the recording screen.

6. Browse web application for example: www.google.com, and wait until the page is fully Navigate few pages there.

7. Once the requests and response are captured, their count is displayed accordingly along with the details of captured URLs their request payload and response payload as shown in below figure.

Figure 45: Request Response Count

8. To stop recording of the service, come back to the Service Recording window and click the Stop Recording

9. After user click the Stop Recording button, Request and Response of every URL are displayed as in the snapshot. The service and template names for each URL are assigned automatically, which can also be edited.

Figure 46: Header List

After creating a service through recording, all the respective headers, status code are configured in the service level and template level as well. It takes less time to configure all the headers, which are captured through recording.

User can either configure or not configure service-time during recording by using the “Enable Service Time” check box.

Figure 47: Enabling Service Time

10. Likewise, request and response can be recorded for other URLs too.

11. To create the service, select the check box for the particular URL and click on Create Service(s) or Create Service(s) and Activate

12. If the service already exists, the following window is displayed.

Figure 48: Warning Window

For any service, which is already simulated in server, user can create services according to their needs after recording the application URL. This avoids addition of templates into existing service with same URL.

Options available:

  • Create the template in the Existing Services.
  • Delete the Existing Services and create new Recorded Services.
  • Disable the Existing Services and create new Recorded Services.
  • Create Backup (Disabled Mode) and Delete Existing Services and create new Recorded Services.

13. Once, user click the Create Service(s) button, service gets added and is displayed in the list of services.

 

Web Page Recording

  1. Select Web Page Recording option from the Recording Type drop down.
  2. Provide the required details, such as recording name, recording port and click Add. For details of these fields refer to HTTP Recording Configurations in the above section.
  3. Click the Start Recording button to start the recording.
Figure 49: Start Recording

4. Import the certificate file. (Get it from your Cavisson representative).

5. Open the browser and enable proxy. Use the IP and port for proxy servers for all protocols as mentioned in the below window.

6. Browse the application and wait until the page is fully loaded.

7. The captured request and response count is displayed along with captured URLs, request payload, and response payload.

Figure 50: Recording Status Page

8. After user click the Stop Recording button, the Request and Response of every URL are displayed as in the snapshot. The service and template names for each URL are assigned automatically, which can also be edited.

Figure 51: Header List

After creating a service through recording, all the respective headers, status code are configured in the service level and template level as well. It takes less time to configure all the headers, which are captured through recording.

User can either configure or Not-Configure service-time during recording by using the “Enable Service Time” check box.

9. To create the service, select the check box for the particular URL and click on Create Service(s) or Create Service(s) and Activate

Figure 52: Capture Host Info

10. Click Proceed. The captured web page recording is displayed on the Manage Services

Figure 53:Manage Service Window

Note: ‘Host’ column displays the host name mentioned at the time of recording.

JDBC Recording

  1. Once the JDBC recording configurations are done, click the Start Recording Here, the example is for recording a sample application – nsecom.

Note: For nsecom application URL, kindly connect with Cavisson representative from Client Support team.

Figure 54: Recording Configuration

2. In the Browser, provide the host/IP and port and then nsecom.

Example: 10.10.40.18:8003/nsecom

 

3. Go to Home-Page, then place the order completely for complete recording.

Page – 1

Page – 2

Page – 3

Page – 4

4. Stop the recording and provide the service name.

Figure 55: Recording Status

5. After user click the Stop Recording button, the Request and Response of every URL are displayed as in the snapshot. The service and template names for each URL are assigned automatically, which can also be edited.

Figure 56: Request response page

6. Click the ‘Create Service(s)’ button. This creates the service.

Figure 57: Service Page

Socket Recording

  1. Once the configurations are done, click the Start Recording button to start the recording.
Figure 58: Recording Status Page

Note:

  • Setup the TCP Client to record the services.
  • UI displays the count for the request and response.
  • The recorded request and response are displayed in the UI.
  • User can see the individual request and response for the all recorded request and response.

2. Stop Recording: Once user is done with the recording, stop the recording.

Figure 59: Recording Status Page

3. Captured Request Response List: After stopping the recording, request and response list is displayed on the UI. All the recorded information is displayed on the UI.

Figure 60: Capture Service List

User can see the following recorded information on UI.

  • Recording name: Recording name is displayed as provided at the configuration time.
  • Port: Port name as configured.
  • Service name: User can see the service name of each recorded request; accordingly, it is displayed on the UI. It is a combination of Recordingname_Socket_port_randomVal.
  • Templates: All the templates are displayed as template1 by default.
  1. Create Services: User can create the services for the selected records.

Following conditions are displayed according to the port used in the recording.

If recorded host is captured on the same port, which is already used by the existing services, then user need to select the following option:

  • Create a template in the existing service on the same port.
  • Delete the existing service and create new recorded services.
  • Disable the existing service and create the new recorded services.
  • Take backup of existing services and create a new service.
Figure 61: Warning Page

5. Create and Activate Services: User can create and activate services.

6. Manage Services: All the services list is displayed in Manage Services page.

 

Add Service

User can add a service manually by following four ways:

  • Using User Input
  • Using RR Pairs
  • Using WSDL
  • Using Open API

Adding a Service – Using User Input

A user can create a service here manually. By directly providing the inputs. Using user input, a user can create a service by directly providing the inputs.

  1. On the Services menu, hover to Add Services menu item as shown in below figure.
Figure 62: Add Service

2. Now click the ‘Using User Input’ to create service manually as shown in below figure.

Figure 63: Using User Input

Service Type – HTTP(s)

Go to the Add Service window and select HTTP(s) in the service type as shown in below figure.

Figure 64: HTTPs-Service Type

Enter following fields to add the service as displayed below:

  • Service Name: It is the unique name of the service.
  • URL: Enter the URL of the service.
  • Template Name: Template is the response identification. A service can have multiple templates which can be added once the service is created.
  • Response Content Type:
  • The content type specifies the media type for the response.
  • Here user can select the content-type for the response from the drop-down list.
  • If no Content-Type is specified, the default is none.
  • Regular Expression: It allows use of regular expression in URL so that if some pattern changes in request and remaining URL is same then Service Virtualization responses for this request.
  • Ignore Case: If it is enabled, then URL becomes case insensitive.
  • Complete Match: It is used to match the complete URL.
  • Protobuf Settings: Here a user can directly upload the protofiles by enabling the checkbox for protobuf, and can provide a name for the protofile.
  • Click the Protobuf Settings This displays the Protobuf Settings window.
Figure 65: Protobuf Settings Window
  • There are two sections: Request and Response. Provide the following details and click Save.
  • Enable Protobuf: Select this check box to enable Protobuf.
  • Upload Proto File: Select the Proto file by using the Choose button or paste the file content in the body section.
    • Request Proto file: To get the content in encoded format as passed in the request.
    • Response Proto file: To get the response in encoded format from the server.
  • Proto File Name: Provide the name of the proto file.
  • Message Type: This contains the schema of proto file. This displays the parsed message types from the uploaded proto file. If the content of the proto file is modified, the ‘Message Type’ drop-down is automatically refreshed.

Note: All the fields in ‘Request’ and ‘Response’ sections are mandatory if enabled.

 

  • When user hit a service from Service Virtualization, the data is sent in the encoded format.

 

If for Response, Content-Type is set to application/x-protobuf or x-application/protobuf then, only response will be converted into protobuf format. Example –

Possible Content-Type header to convert body into protobuf are –

Content-Type: application/x-protobuf

OR

Content-Type: x-application/protobuf

  • Sample Request: Sample request of the service. This is used for testing and for defining Request Parameters. User can select a file where sample request is stored by clicking the Choose
  • Response Template: Response of this service for this template. User can parameterize it later using different types of parameters. They can select a file where sample response is stored by clicking the Choose
Figure 66: Service Information

2. Click on Add The service is added and Service Virtualization services window is displayed.

 

 

Smart Editor

Service Virtualization has certain text areas where user get long xml, JSON, etc. The content is not formatted in most cases which leads to the need for a Smart Editor which adds color-codes and formatting to the content making it easier to read and analyze.

Features

  • Beautification/formatting of ugly/minified XML, JSON, HTML, CSS, JavaScript.
  • Addition of color-codes in XML, JSON, HTML, CSS, JavaScript. This feature displays content in different colors according to the category of terms. This feature facilitates writing in a structured language such as markup languages both structures and syntax errors are visually distinct. Highlighting does not affect the meaning of the text itself; it is intended only for human readers.
  • Auto-Closing of tags in XML/HTML when opening tag is completed with intelligent handling for singular/Unpaired tags.
  • Code-Folding to collapse (hide) and expand parts of a file, making it easier to focus just on the parts of interest.
  • Highlight matching Tag in XML, HTML that highlights the corresponding matching tag.
  • Highlight matching bracket (like round brackets, square brackets, box brackets) at current cursor position.
  • Placeholder display in case of blank content in editor.

Functionality

  1. To add color-codes to the content, select the specific content type from the drop-down.
Figure 67: Content type

2. After selecting the content-type, color-codes is added as follows:

Figure 68: Color Coded Added

Formatting Content

  1. To format the content for a specific type, select/highlight the content in editor.
Figure 69: Highlighted Content for Formatting

2. Click the beautify icon ( ) to format the contents.

Figure 70: Formatted Content

Generic Socket Type Service

Apart from HTTP(s) service, the user can also virtualize generic socket services. A support is provided for services, which can respond to generic data coming on a TCP socket configured by the user.

  1. Go to the Add Service window and select the Service Type as Generic Socket as shown in below figure.
Figure 71: Generic Socket
  1. Provide the service information and fill the following fields:
    • Service Name: Enter the name of the generic socket service.
    • Template Name: Enter the template name.
    • SSL Port(s): Fill in the HTTP port(s).
    • Non-SSL Port(s): Fill in the HTTPs port(s).
  2. Select the sample request, response, and click Add.
  3. The service is added and displayed within the Services section of the Service Virtualization Manage Services window.

Adding a Service with Binary Payload

User can also upload binary data for request/response payload of HTTP/TCP services in the Add Service window.

  1. Go to the Add Service window.
Figure 72: Add Service Window

2. Fill out the other details of the service to be added.

3. If the file to be used as payload is a text file (Content type: “text/*” or “application/json”), click the Choose button and select the respective file. In such a case, the contents of a file are displayed on the respective request/response editor so that user can modify the contents of editor according to the need.

4. If the payload is a binary, then click on Choose button and upload the file. After upload, the respective request/response editor is set as read-only. Finally, click the Add button to add the service.

Note: The binary and text files are distinguished based on Content-type given by the operating system during upload. Therefore, the files with content-type as “text/*” and “application/json” are only treated as a text file and displayed on the editor for any modifications. In all other cases, the payload is directly uploaded and is configured during the addition of service.

Adding a Service – Using RR Pairs

Service Virtualization allows user to create service using request/response(RR) pairs that contain information in the form of HTTP headers and body. It is convenient to use when their backend server is under development and user don’t have recording setup, however they have request-response pairs of that backend.

RR pair consists of one request and one or more responses that follow the below naming conventions:

  • The file name consists of a prefix, a suffix, and optionally a file extension.
  • The prefix is a unique identifier which is used to tie request and response in a pair.

User must use the same prefix in all the file names that correspond to a particular pair.

  • The suffix of a request file is -req.
  • The suffix of a response file is -rsp.

Example 1:

⦁    GetLoyaltyReward-req.xml

⦁    GetLoyaltyReward-rsp.xml
Here in this pair GetLoyaltyReward is prefix and -req/-rsp is suffix and .xml is file extension.
Example 2: In case user have multiple responses, add a number to the end of each response suffix. There are four responses.

  • GetLoyaltyReward-req.xml
  • GetLoyaltyReward-rsp.xml
  • GetLoyaltyReward-rsp1.xml
  • GetLoyaltyReward-rsp2.xml
  • GetLoyaltyReward-rsp3.xml

Request file consists of following sections:

  • HTTP request line (e.g. POST /api/v2/merchants/payment HTTP1.1)
  • Zero or more HTTP headers
  • EMPTY LINE (there should be only one empty line)
  • Payload (XML, JSON, TXT, …)

An example of a REST request file:

POST /api/v2/merchants/payment HTTP/1.1Accept: application/jsonContent-Type: application/jsonContent-Length:216 {  “amount”: {    “amount”: 10.5,    “currency”: “USD”  },  “paymentMethod”: “wallet”,  “PayPalWallet”: {    “Balance”: 956.23,    “WalletID”: “UX876QAC”  },  “transactionChannel”: “Web Online”}

In case of SOAP request, request file can have only payload. (see note for more detail). An example of a SOAP request file:

POST /loyalty/loyaltyservice/v1 HTTP/1.1Content-Type: application/soap+xml; charset=utf-8
Content-Length:479 <?xml version=”1.0″ encoding=”UTF-8″?><soap:Envelope>   <soap:Header>      <v1:request_header>         <v11:requesterName>POS</v11:requesterName>         <v11:requestDate>2013-05-09</v11:requestDate>      </v1:request_header>   </soap:Header>   <soap:Body>      <v1:searchRewards>         <v11:provider>cavisson</v11:provider>         <v11:emailAddress>perfemail1@cavisson.com</v11:emailAddress>      </v1:searchRewards>   </soap:Body></soap:Envelope>

 

Similarly, a response file consists of following sections:

  • HTTP response line (e.g. HTTP/1.1 200 OK)
  • Zero or more HTTP headers
  • EMPTY LINE (there should be only one empty line)
  • Body (XML, JSON, TXT, …)

An example of a response file:

HTTP/1.1 200 OK

{

  “orderAmount”: 10.5,

  “currency”: “USD”,

  “completable”: true,

  “timestamp”: “04-15-22/03:05”,

  “transactionReferences”: [

    {

      “transactionId”: 3495717101571,

      “transactionType”: “InitiateDebit”,

      “transactionDate”: “04-15-22/03:05”,

      “transactionDesc”: “Transaction Accepted”,

      “status”: “Processed”,

      “paymentMethod”: “PayPal”

    }

  ]

}

An example of a SOAP response file:

HTTP/1.1 200 OK

<?xml version=”1.0″ encoding=”UTF-8″?>

<soap:Envelope xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/”>

   <soap:Body>

      <searchRewardsResponse xmlns=”http://service.cavisson.com/Loyalty/LoyaltyService/v1″ xmlns:ns1=”http://schema.cavisson.com/Loyalty/LoyaltyData/v1″>

         <ns1:returnCode>0</ns1:returnCode>

         <ns1:accounts>

            <ns1:account>

               <ns1:membershipIdentifier>

                  <ns1:provider>cavisson</ns1:provider>

                  <ns1:identifier>841010</ns1:identifier>

               </ns1:membershipIdentifier>

               <ns1:emailAddress>

                  <ns1:emailAddress>perfemail1@cavisson.com</ns1:emailAddress>

               </ns1:emailAddress>

               <ns1:loyaltyCardFlag>false</ns1:loyaltyCardFlag>

               <ns1:tier>BASE</ns1:tier>

               <ns1:member>

                  <ns1:phoneNumbers>

                     <ns1: phoneNumber>

                        <ns1: phone>1306295190</ns1:phone>

                        <ns1: type>HOME</ns1:type>

                     </ns1: phoneNumber>

                  </ns1: phoneNumbers>

               </ns1:member>

            </ns1:account>

         </ns1:accounts>

      </searchRewardsResponse>

   </soap:Body>

</soap:Envelope>

Steps to Add a Service using RR Pair

On the Services menu, go to Add and click the Using RR Pairs option as shown in below figure.

Figure 73: Using RR Pairs

2. This displays the RR Pairs Service Configuration

Figure 74: RR Pairs Service Configuration Window

3. Now select the option how user wants to choose RR pairs either by Using Files or Directory. When a user selects “files”, then the they should upload files with -req and -rsp format. When a user clicks “Directory”, the need to create a directory of request and response files in their local machine and upload it as needed.

4. Next click on Choose RR Pairs and select the RR pairs which the user wants to upload.

Figure 75: RR pairs

5. In other case selecting the option Using Directory, click on Choose Directory and select the directory of RR pairs.

Figure 76: Using Directory

6. Once user selects the required files or directory, click on Upload. This displays captured URLs under Captured URL List.

Figure 77: Captured URL List

7. Here Request displays the request header with request payload. 

  Request payload displays the request payload only.

  Response displays the response header with response payload.

  Response Payload displays the response payload only.

8. If the user wants to Reset the table data, they can click the button “Reset”.

Figure 78: Create Service selection

9. Once the selected files or directory gets uploaded we can click on Create Services this will get our service enlisted on Manage Service UI.

10. Other options like Cancel, Filter and create & activate services are for canceling the service, applying filters in Captured URL list, and for creating and activating the service respectively.

Figure 79: Service Name Selection

Notes:

  1. The service name will be created by file name however it is editable, the user needs to click the name and edit it.
  2. In case SOAP request does not have a request line then service is created with service url “ /cav_soap_service”. And other services without request line are added as template in same service.
  3. While creating service, service virtualization server does auto correlation i.e. it automatically detects the value in response that matches in the request and replace those values with parameters.

Adding a Service – Using WSDL

Service Virtualization provides a feature through which all client services, which are exposed through WSDL, can be imported in Service Virtualization. User needs not to create the services manually, write the requests, and response in Service Virtualization. They will get all the exposed Services/Operations in drop down and can select the Service/Operations from there, which needs to be migrated.

WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. The operations and messages are described abstractly, and then bound to a concrete network protocol and message format to define an endpoint. Related concrete endpoints are combined into abstract endpoints (services).

WSDL is often used in combination with SOAP and XML Schema to provide web services over the Internet. A client program connecting to a web service can read the WSDL to determine what functions are available on the server. Any special datatypes used are embedded in the WSDL file in the form of XML Schema. The client can then use SOAP to actually call one of the functions listed in the WSDL.

Steps to Add a Service using WSDL

  1. On the Services menu, go to Add Services and click Using WSDL as shown in figure below.
Figure 80: Using WSDL

2. This displays the WSDL Service Configuration

Figure 81: WSDL Configuration

3. Specify the URL of WSDL file.

For example: http://www.dneonline.com/calculator.asmx?wsdl

4. Click the Fetch Service Configurations This fetches the configuration of the WSDL file. Note: User can either import service using file by uploading the WSDL file or specify the request/response in the text area and add service.

5. Fetch Service provides all the services, which are available to Client and all operations associated with that service. Select the service from the list and the operation corresponding to the service.

Figure 82: Fetch Service Configuration

6. Selection of URL. Add Detail over here

7. Click the Create Services The service is added successfully.

Figure 83: Captured URL List

This adds the service in the Services list.

Figure 84: Added Service

Note: A user cannot save a WSDL service with a name that already exists. While doing so, an error message “Service Name is already there. Please assign other name” is displayed.

Adding a Service – Using Open API

Service Virtualization provides a feature through which all client services, which are exposed through Open API, can be imported in Service Virtualization. User need not to create the services manually, writing the requests, response in Service Virtualization. User will get all the exposed Services/Operations in drop down and can select the Service/operations from there, which needs to be migrated.

Open API is an open-source software framework backed by a large ecosystem of tools that helps developers design, build, document, and consume RESTful Web Services. While most users identify Open API by the Open API UI tool, the Open API toolset includes support for automated documentation, code generation, and test-case generation.

User needs to provide the JSONlYAML through which all the services can be exposed and added in Service Virtualization.

Steps to Add a Service using Open API

  1. On the Services menu, go to Add Services and click Using Open API option as shown in below figure.
Figure 85: Using Open API

2. This displays the Open API Configurations

Figure 86: Open API

3. Browse URL of open api document.

For example: https://petstore.swagger.io/v2/swagger.json

4. Click the Fetch Open API Specification This fetches all the services, which are available to Client and all operations associated with that service.

Figure 87: Open API(using URL)

5. Click This displays the resource list with service and template name. User can select one or more of them to add service.

Figure 88: Resource List

6. Click the create Service This adds the service.

7. Optionally, user can test a service by clicking on Test under Action They can either do a test on original service or to some other endpoint. Also, there are other options example to give query parameter, header and modification of request payload. User can further save the response by clicking on Save button. This would create service with this saved response.

Figure 89: Action-Test Selection
Figure 90: Test Configuration

For test configuration, fill in the following fields:

  • Method: Enter the HTTP methods for retrieving from and sending data to a server. GET, POST, PUT, PATCH, and DELETE are the five most common HTTP methods.
  • Scheme: Select HTTP or HTTPS for scheme.
  • Host: Enter the host name in this field.
  • Port: Fill in the port number.
  • URL: Write the URL of Open API.
  • Query: Enter the query/status.
  • Header: It is the name of the header which is to be given.

 

 

Manage Service

In manage home page, there are following fields which are described below:

 

Figure 91: Manage Service HomePage
  • Service Name: The unique name of the service.
  • EndPointURL: It is the web address (URL) at which the clients of a specific service can gain access to it.
  • Templates: Template uses various parameters to send the appropriate response based on the request data.
  • LastModified: The date and time when this service was last modified.
  • LastUpdatedBy: Shows the person which has last updated the services.
  • State: It defines the state of the service i.e:
  • Running: This state indicates that the service is running.
  • Stopped: This state indicates that the service is stopped.
  • Created: Indicates that the service is created.
    • Mode: It defines the mode for the type of service. The following modes are listed below:
  • Simulate: It is the request for the same server.
  • Forward: It supports the ability to forward the request to another endpoint.
    • ServiceType: It is the type of protocol in which the service runs. There are following service types available:
  • TCP: It is a standard of communication that enables application programs and computing device to exchange message over the network.
  • HTTP: It is a communication protocol which is used to connect to Web servers on the internet or on a local network.
  • JMS: Java Message Service is an API that provides the facility to create, send and read messages.
    • Host: Hostname or IP address of the backend server or endpoint server is the server from where the response is captured to the Service Virtualization.
    • Action: In Action, there are following options which are listed below:
  • To Edit Service: Click the edit It is used for editing an existing service.
  • To Copy Service: Click the to copy. It is used to make a copy of an existing service for creating a new service.
  • To Move Selected Service(s) to Recycle Bin: Click the It is used for moving a selected service to the recycle bin.
  • Test: Test service allows user to test a service on the virtual server where the service is hosted. It is recommended to do a quick validation of service before using it in Load/Performance testing.
  • Activate Service: Used for activating a selected service.
  • Scale Service Time: Used to apply scale service time to a service.
  • Export Service: This option is used to export a service through a file name.

Manage Service can be done using following:

  • Using Templates
  • Using Service Parameters
  • Using Service Settings

Template Settings

Using Templates

Template is used for defining the response of the service. By default, every service has one template, which is used for the response of the service. One service can also have more than one response based on request or the test conditions. In this case, user needs to add multiple templates. Another situation is when service has two responses – one for successful response and one for error response. In this case, user needs to define two templates. In case of multiple templates, they need to provide condition logic for the selection of the template for the service response. Service Virtualization evaluates condition of all the templates in sequence and uses the first template whose condition is met. If there are no templates with matching condition, then no response is sent. User can have one template with no condition which becomes the default template in case no condition is met.

Adding a Template

Click Templates Settings menu  as shown in below figure.

Figure 92: Template Settings Icon

2. The All Templates window is displayed as shown in below figure.

Figure 93: Template Settings

Note: An user can adjust width of table columns. If the table width is exceeded with the screen width, a horizontal scroll bar is displayed at the bottom. This allows the user to view the conditions which exceed the column width.

Service

In Service, there are following two fields:

  1. Service Name: In service name, user can see the name of the service whose template’s a they can configure.
  2. End Point URL: In end point url, it shows in which URL the service is being running.

Template(s)

In Template(s), there are following fields which are described below:

  1. Order: It shows the order in which the condition will be evaluated.
  2. Template Name: It is a list which contains the number of templates available in current service. Response comes by the selected template.
  3. Mode: There are two types of modes:
  • Simulate: This template type indicates the simulation of service on server. If template type is ‘Simulate’, then virtual server responses for the request.
  • Forward: This feature is used to forward a request from virtualized server to a specified endpoint.
  1. Service Time: It is used to set the service time delay for static and correlated URL.
  2. Status: It is used to show the status of the job. The status can either be Active or can be Inactive.
  3. Template Selection Condition: It shows the conditions applied to the template. There will be one default template in this list.
  4. Action: In action, there are following options mentioned below:
  • Template Based Test: This option is used to do test the response at the template level.
  • Template Based Header : This option is used to add header in templates.
  • Template Based Service Time : This option is used to add service time in templates.
  • Template Based Trace Level : This option is used to add trace level to a specific template.
  • Update : This option allows to update or edit the template.
  • Forward: This feature is used to forward request from virtualized server to a specified endpoint.
  • Template Based Content Length Indicator: This indicates the length of the content. Enabling this will indicate the content length of the template.
  • Protobuf Settings: Here user can change or add the protobuf settings if required.

Note: User needs to click on the check box of the template in order to delete or inactive the template.

Adding a Template

The template is used for defining the response of the service. By default, every service has one template, which is used for the response of the service. One service can also have more than one response based on the request or the test conditions. In this case, the user needs to add multiple templates.

Click Add button  to add a new template.

Figure 94: Add Template Button

  The Add template window is displayed.

Figure 95: Add Template

To add a template, enter the following fields:

  • Template Name: Enter the template name in this field. It is the unique name of the template within this service.
  • Response Template: It is the response of the service for this template. User can parameterize it later using different types of parameters. From the drop-down the they can select following action:

Note: Once a user selects any parameter, their corresponding parameter name will

  • Sample Request: Sample request of the service. This is used for testing and for selection of Prefix and Suffix in Request Parameters.
  • Beautify: Click the beautify icon ( ) which formats the content. From the dropdown select either of CSS, Text, HTML, Javascript, XML or Json as per the requirement.
  • Action: User have the following actions type in response template and their corresponding sub fields:
  • Replace selected text by parameter: Select this option and from the corresponding sub fields select the name of the parameter name for replacing. On selecting this option, the selected text will be replaced by a parameter.
  • cav_cur_date: It will replace the selected text with the date parameter.
  • cav_http _method: It will replace the selected text with http methods.
  • cav_sequence: It will replace the selected text in a particular sequence.
  • cav_regex_url_match_pattern: It will replace the selected text with the URL pattern.
  • SOAPOperation: Replace the selected text with SoapOperation.
  • AccountSummary_Request_VAR_Associate_Number: It will replace the selected text with account summary request VAR Associate Number.
Figure 96: Replace selected text by parameter

Replace selected text by sequence number: Select this option and enter the start sequence number from the corresponding sub fields to replace. On selecting this option, the selected text will be replaced by the sequence number.

  • Enter start sequence number: This indicates the start of the sequence number which the user has to provide which will indicate from where the text will be replaced.
Figure 97: Replace Selected text by sequence number

Mark selected text by repeatable block: Select this option, select from the sub fields drop down the block repeat upon value and enter the separator name. On selecting this option, the selected block will be repeated.

  • Select the block repeated upon: This option will select the text on which the block will be repeated.
  • Value of the Parameter: It shows the value of a parameter.
  • Number of Occurrence of parameter: Show occurrence number of the parameter.
  • Fixed Number: The selected block will be repeated for fixed number.
Figure 98: Mark selected text by repeatable block

Replace selected text by date parameter: Select this option, from the sub fields drop down select the format of date and then select the offset number. On selecting this option, the selected text will be replaced with date format.

  • Format: Select text will replace by format.
  • Offset: Enter the offset number.
Figure 99: Replace selected text by date parameter

Add request parameter and replace the selected text by it: Add request parameter and in the corresponding fields enter the attribute name. On selecting this option, the added request parameter will be replaced with the selected text.

  • Attribute Name: Enter the name of the attribute.
Figure 100: Add request parameter and replace selected text by that parameter

Add query parameter and replace the selected text by it: Add request parameter and in the corresponding fields enter the query name. On selecting this option, the added query parameter will be replaced with the selected text.

  • Query Name: Enter the query name.
Figure 101: Add query parameter and replace the selected text by it

Add XML parameter and replace selected text by it: Add XML parameter and in the corresponding fields enter the XML node path. On selecting this option, the added XML parameter will be replaced with the selected text.

  • XML Node Path: Enter the XML Node path.
Figure 102: Add XML parameter and replace selected text by it
  • Sample Request: Sample request of the service. This is used for testing and for selection of Prefix and Suffix in Request Parameters.
  • Response Template: Response of this service for this template. User can parameterize it later using different types of parameters.

3. Click the Save button to save the template and to go back to Templates window.

Selecting Condition of a Template

If more than one template is used, then user needs to provide the condition for the selection of all additional templates. Conditions can be defined based on variable values or request.

Steps for adding condition of a Template

  1. Expand Add condition for the selection of this template.
Figure 103: Add Condition for selection
  1. Select following argument for the condition:

Action:

  • Parameter Name: Parameter name to be used in the condition.
  • Type: Type of parameter – String or Numeric.
  • Condition Operator: Select condition operator:
  • Equal To
  • Not Equal
  • Greater Than
  • Less Than
  • Greater Than Equal To
  • Less Than Equal To
  1. Right Hand Side: Select any parameter or constant value.
  2. Click Add button to add this condition.
  3. To add more conditions for this template, select Logical Operator (AND or OR) and add condition using above steps.
  4. After condition is added, it is displayed in the Applied Condition text box. For example, following condition has two conditions with logical operator of AND. This condition is try if value of Amount variable is >= 10 AND <= 100.

Add Template based Headers

Service Virtualization sends following headers in the service response:

  • Content-Length.
  • Content-Type – If content type was selected for the template.
  • Any additional header specified in global header files.
  • Any header added using C API used in the Callback methods.

Using HTTP header setting, user can send additional HTTP headers in the response for the service. To add template based headers, click the  icon on the templates page as shown in below figure.

Figure 104: HTTP Header Icon

A pop-up window is displayed as shown in below figure. Add additional HTTP headers for that template and click Save.

Figure 105: Additional HTTP Headers

Note

  1. ‘Template Based Headers’ has higher priority than ‘Service Based Headers’.(Example:- ‘Service Based Headers’ will be overridden if ‘Template Based Headers’ is defined in that Service.)
  2. Template based ‘Content type header’ has higher priority than Service based ‘Content type header’. (Example: – Service based ‘Content type header’ will be overridden if Template based ‘Content type header’ is defined in that service.)

Advanced Settings

  • Content Type: Here user can select the content type for their header. The Content Type property of header specifies the HTTP content type for the response. If no Content Type is specified, the default is text/HTML.
  • Compression Type: User can compress the response by using compression types – Deflate, Gzip, and BR. Selected compression type format is displayed under the Response Template.
  • HTTP Status Code: User can configure the percentage of the selected HTTP Status code to be reflected in the response of the service.
  • Enable Date header: Here user can enable date header it will help indicating date in the header.

 

Add Template based Service Time

Response time delay or service time delay is the time taken between request sent by the client and the response received by the client. The user can check the time delay between client and server and see its value.

Service Virtualization sends response of the service as soon as the request is received. Therefore, there is no delay in the Response. User can add service time delay by using Service Time Delay settings. To add template based service time, click the    icon on the templates page. A pop-up window is displayed to add service time delay.

Figure 106: Template Level Service Time Delay

To use template based service time, select the Enable Service Time check box.

There are following options under this section:

  • No Service Time: No service time delay is applied. Helps in doing max load testing.
  • Exponential Random Service Time:  Exponential random service time with median of specified seconds is applied. This takes a random value equivalent to median time.
  • Constant Service Time: A constant service time of specified seconds. Helps in doing controlled tests.
  • Random Service Time: It is more Realistic. The value is a random value between the minimum and maximum time defined. Min should be less than or equal to Max.

Click Save.

Add Template based Trace level

To add template based trace level, click the  icon on the templates page as shown in below figure.

Figure 107: Add Template-Basedd Trace Level Icon

A pop-up window is displayed to add trace level as in below figure. Specify the Trace level, and click the Save button.

Figure 108: Trace Level Detail
  • Disabled: No logs.
  • It logs URL and Parameter like parameter name, parameter value etc.
  • With addition to the above point it also logs request and response.

Now click the kebab menu  on the action panel as shown in figure below:

Figure 109: Action Kebab Menu

Template based Content Length Indicator

Content Length Indicator allows a user to transfer data into a series of overlapping chunks.

To add template based Content Length Indicator, click the option as highlighted in below figure.

Figure 110: Add Template Based Content Length Indicator

 A pop-up window is displayed to enable Content Length Indicator as shown in below figure.

Figure 111: Template Based Content Length Indicator

Once the user selects the Enable Content Length Indicator check box, more options are displayed.

  • Mode: There are two modes – ‘disable’ and ‘enable’ to specify whether the features should be disabled or enabled.
  • Chunk Scheme: There are two chunk schemes:
  • Size of Chunk: It displays the size of the individual chunk.
  • Number of Chunk: It displays the number of chunks in which the response should be served.
  • Default Size of chunk: It displays the default size of chunks in Bytes, by default the size is 1440.
  • Default Number of chunks: It displays the default number of chunks.
  • Size of chunk: The check box for Default size of chunk/Default number of chunks is selected by default. The user must clear the check box to enter a value other than the default value. Click Save.

The default size of a chunk is 1440 bytes and the default number of chunks is 2.

Sequence shows the order in which the conditions will be evaluated. Template with first matching condition is used for response. Default template (one without condition) is used if no other conditions match.

Note: With Template Ordering button, the user can change the sequence number of the templates in a virtual service. It helps them to simulate their services as per priority.

 

Forward

Using this feature, user can provide forward settings to service level as well. To access Forward Settings, click on the kebab icon on the action menu and select Forward as shown in below figure.

Figure 112:Forward

Once user click the above option, the following page opens as shown in figure.

Figure 113: Forward Settings

These settings include – Protocol, Host/IP, Port, Forward Request Header, SSL Settings, and General Settings.

  • Protocol: This is used to specify protocol of recording whether it is HTTP or HTTPS.
  • Host/IP: Hostname or IP address of the backend server or endpoint server is the server from where the response is captured
  • Port: By default, HTTP Port is 80. User can give the another port according to configuration.

 

Forward Request Header: User can provide the Request Header in the forward mode. There are following options:

  • Mode: There are three modes available for the Forward Request Header – Add, Modify, Delete.
  • Header and Values: User can provide the header and values for the Request header. Example: Content-Type: json.

Note

  • If user select the delete option in Mode, they do not need to provide the header values.
  • User can delete a header by clicking the button.

SSL Settings: User can provide the following SSL settings in this section.

Figure 114: SSL Settings
  • TLS Version: User need to provide the TLS Version.

Following options are available:

  • All version(s)
  • TLS 1.0
  • TLS 1.1
  • TLS 1.2
  • TLS 1.3
  • SSL Renegotiation: A number of Internet connections require SSL renegotiation, a Secure Sockets Layer/Transport Layer Security process that allows the changing of the details of a handshake after a connection is made with the server. There is a checkbox for the SSL Renegotiation, which the user can enable/disable it.
  • Cipher Suite: A cipher suite is a set of algorithms that help secure a network connection that uses Transport Layer Security (TLS) or its now-deprecated predecessor Secure Socket Layer (SSL). There is a list of cipher suite from where user can select the required ones.
  • Server Require Authentication for Client Certification: If user enable this check box, they need to provide the certificate.
  • Certificate File: The uploaded certificate file will be saved in the service directory.
  • Key File: On selecting the ‘Separate Key File Required’ checkbox, user need to upload the key file. The key file will also be saved in the service directory.

General Settings: There are following general settings available in this section:

Figure 115: General Settings

Forward Percentage: It is the % of request to be forwarded, the remaining will be served in simulated mode. Forward percentage should be in the range (0-100) up to 2 decimal places. Example: If user mention the percentage as 20%, then remaining 80% will be served as simulate mode.

Enable Service Time: In Forward mode, since response is coming from backend, there is no need to apply service time. However, in some cases, service time may be required and in that case, user can select the ‘Enable Service Time’ check box. Response time will the max of service time or the backend response time.

Examples:

  • If backend response time is 100 ms and service time is 200 ms, the client request time will be 200 ms.
  • If backend response time is 300 ms and service time is 200 ms, the client request time will be 300 ms.
  • Replace/Add HOST Header in the Forward Request: If host header is coming in the request, it will be replaced.
  • Connection Timeout: User can provide the connection timeout option at template level also and it will be treated on the high priority.
  • Response Timeout: User can provide the Response timeout at service level/template level.

 

Modify Forward response settings

There are the following forward response settings available:

Figure 116: Modify Forwards Response Settings
  • Occurrence count: This property is used when the source value of a search parameter can occur multiple times in a request. It indicates which instance of the value should be extracted.
  • Ignore Case: If enabled, response becomes case sensitive.
  • Field Name: User need to provide the field name for which they want to replace the values.
  • Current Value: Select the current value from the drop down. There are some pre-defined values displayed in the drop down
  • Update Value: User can select the updated value from local directory by clicking the Add They need to provide the updated value for that field.

 

 

Parameter Settings

Using Service Parameters

User can define various parameters associated with a service. Parameters are variables whose values could be set based on the incoming request, or user defined to be picked from a dataset or different inbuilt functions. Parameters are used for parameterization of the response templates, in defining conditions for selection of the template and as index for Indexed Datasets. Service Virtualization supports several types of parameters to hold the values for composing service responses, template selection and data selection.

User have the following fields in Service Parameters:

  • State: Shows the status whether parameter is enable/disable.
  • Type: This field shows the type of parameter in service parameter.
  • Name: It shows the parameter name given.
  • Specification. It shows the details of the particular parameter like prefix, suffix etc.

In Service virtualization tab, user need to click on any service name in which they want to add parameters. the Edit Service page is displayed.

Figure 117: Service Parameter

Order shows the order in which the conditions will be evaluated. Template with first matching condition is used for response. Default template (one without condition) is used if no other conditions match.

Note: With Template Ordering button, the user can change the sequence number of the templates in a virtual service. It helps the users to simulate their services as per priority.

  1. Click Parameters Settings  menu > Service Parameters to view the service parameters.
Figure 118: Service Parameter Icon

Once user click Service Parameter, the following page opens:

Figure 119:Service Parameter

To add service parameters, click the Parameter Settings menu > Add Parameters.

Figure 120: Add Parameters

Using parameter section, the user can add following parameters:

  • Search Parameter
  • SearchIn Parameter
  • Request Parameter
  • SQL Query Parameter
  • URL Query Parameter
  • Scratch Parameter
  • Scratch Array Parameter
  • Data Set
  • Indexed Dataset
  • Data Time Parameter
  • Random Number
  • Random String
  • Unique Number
  • Cookie Parameter
  • XML Parameter
  • Condition Logic
  • JSON parameter

The user can import parameters from another service by using the Import button as shown in below picture.

Figure 121: Import Parameter

Using this window, user can perform following tasks:

  • Delete: Delete a parameter.
  • Update: Update parameter specifications. Update displays edit window of the parameter.
  • Import: Import parameters specification in the tabular format for all parameters.

To add a parameter of a specific type, click on the parameter link of that parameter on the left pane.

All parameters are to be provided a unique name. Parameter Name should be started with a character, followed by characters, underscore and numbers. Special Characters are not allowed. Name should be of maximum 64 characters.  Let us discuss the different parameters that we support.

Service Parameter

System Defined Parameters

This section displays some system defined parameters. These parameters are defined by the system; user can only view these parameters. To view system defined parameters, go to Parameter Settings > System Parameters > System Defined Parameter.

Figure 122: System Defined Parameter

Search Parameter

Search parameters are used to hold the values for composing service responses.  The values for a search parameter can be assigned from the content of incoming service requests. The specific part of the request to be assigned is defined using the properties of Search parameter.

Steps to add Search Parameter:

Go to Parameter Settings menu > Add Parameters > Search Parameter. The Add Search Parameter window is displayed.

Figure 123: Search Parameter

Following are the specifications of Search Parameter:

Parameter Details

  • Parameter Name: Unique name for the parameter.
  • Prefix: Expected prefix of value in incoming request.  The starting point from where the value is to be extracted in the request. If no prefix is provided, then start of the request is considered as prefix. Further, user can specify the binary data and regular expression in the prefix by specifying the corresponding values and selecting the ‘Binary Data’ and ‘Regular Expression’ check boxes respectively
  • Suffix: Expected suffix of value in incoming request. The ending point up to which the value is to be extracted in the request. If no suffix is provided, then the end of the request is considered as the suffix. Further, user can specify the binary data and regular expression in the suffix by specifying the corresponding values and selecting the ‘Binary Data’ and ‘Regular Expression’ check boxes respectively.

Note: In Prefix and Suffix, use \n, \r, and \t for new line, carriage return, and tab respectively. All other backslash (\) must be escaped using another backslash(\).

  • Binary Data: Upon selecting this check box, user can search for a string using its ASCII code.
  • Regular Expression: Upon selecting this check box, user can search for a string by providing a regular expression.
  • Ignore Case for Prefix/Suffix: Upon selecting this check box, case is ignored for prefix and suffix.

Example: if prefix/suffix is set to <welcome> or <WELCOME> both cases will be applicable upon selecting this check box.

Advanced Settings

  • Search: This specifies the scope of the search, that is, where to search for the data. The possible values are Body, Header, and URL.
  • Occurrence Count: This property is used when the source value of a search parameter can occur multiple times in a request. It indicates which instance of the value should be extracted. The default index is 1.
  • Any:Randomly one of the occurrences is captured.
  • All: All occurrences are captured.
  • Specified: Particular instance is captured.

 

  • Prefix Matching Mode: This option is required if there are multiple prefixes and a single suffix in the request and the user wants to choose any prefix from those prefixes. The available options are Closest to Suffix, first in the Block, and Specified.
  • Closest to Suffix: Instance in which prefix is closest to the suffix is captured.
  • First in the Block: The first instance within the block is captured.
  • Specified Occurence: Only specified instance is captured. Enter the specified occurrence in field available.
  • Start Offset: This is required if only part of the delimited value needs to be assigned to the parameter. It defines the starting position of the portion which needs to be extracted. (0 indicates first character, 1 indicates second and so on) The offset value must be non-negative. It is enabled when From Beginning check box is disabled. If the Start Offset value is set to 5 then it truncates the first 5 characters and saves this altered data, starting from the 6th position to the last position, in the searched parameter variable. Save Offset value can lie in the range 0-100 (inclusive of boundaries). User can also specify whether to consider a complete length or a specified length.

 

  • Maximum Length: The length of a sub-string of the found value, from the specified offset, to search for the parameter. The default is 0, indicating until the end of the string. It is enabled when Till the end check box is disabled. If the Maximum Length value is set to 5 then it truncates the last 5 characters and saves this altered data, ending from the 6th position from the last position, in the searched parameter variable.
  • Transform: Specifies any built-in transforms which need to be applied to the extracted value before it is assigned to the parameter.
Figure 124: Advanced Settings(Search Parameter)

There are the following options within this:

  • None: It represents the value as it is.
  • Reverse: It reverses the extracted value.
  • Upper Case: It transforms the extracted value in upper case.
  • Lower Case: It transforms the extracted value in lower case.
  • LTrim: It trims the white spaces (occurred at the left) from the extracted value.
  • RTrim: It trims the white spaces (occurred at the right) from the extracted value.
  • Trim: It trims the whitespaces (occurred at the left and right) from the extracted value.

 

Sample Request

  • Template Name: The user can view sample request contents of any template by selecting it from a drop-down list.
  • Set Prefix: This button is to set the prefix by selecting it in the sample request content.
  • Set Suffix: This button is to set the suffix by selecting it in the sample request content.
  • Beautify: It is used for formatting or beautifying the sample requests and response templates in a well-structured format.

 

Searchln

SearchIn Parameter serves a request of selecting the required parameter from various search parameter or any other parameter.

Steps to add SearchIn Parameter

Go to Parameter Settings menu > Add Parameters > SearchIn Parameter. The Add Search Parameter window is displayed.

Figure 125: Add Search Parameter Window(SearchIn)

Specify the following properties for working with SearchIn parameter:

  • Parameter Name: Unique name for the searchIn parameter.
  • Prefix:The starting point from where the value is to be extracted in the request. If no prefix is provided, then start of the request is considered as prefix. Further, user can specify the binary data and regular expression in the prefix by specifying the corresponding values and selecting the ‘Binary Data’ and ‘Regular Expression’ check boxes respectively.
  • Suffix:The ending point up to which the value is to be extracted in the request. If no suffix is provided, then end of the request is considered as the suffix. Further, user can specify the binary data and regular expression in the suffix by specifying the corresponding values and selecting the ‘Binary Data’ and ‘Regular Expression’ check boxes respectively.

       Note: In Prefix and Suffix, use \n, \r, and \t for new line, carriage return, and tab respectively.           All other backslash (\) must be escaped using another backslash (\).

  • Ignore Case for Prefix/Suffix:If user selects this, case will be ignored for prefix and suffix.

Example: if prefix/suffix is set to <welcome> or <WELCOME> both cases will be applicable upon selecting this check box.

Figure 126: Advanced Settings(SearchIn Parameter)

Advanced Settings

  • Search: Specifies the scope of the SearchIn i.e. in which parameter we have to apply the SearchIn to search the delimited data.
  • Occurrence Count: This property is used to identify which instance(s) to capture when the matched value of a SearchIn parameter occurs multiple times in the request.
  • Any:Randomly one of the occurrences is captured.
  • All:All occurrences are captured.
  • Specified:Particular instance is captured.
  • Prefix Matching Mode: This is required if there are multiple prefixes and a single suffix in the request and user wants to choose any prefix from those prefixes. (Default Settings- Closest to Suffix.) Usage of all the options is provided below:
  • Closest to Suffix:Instance in which prefix is closest to the suffix is captured.
  • First in the Block:The first instance within the block is captured.
  • Specified:Only specified instance is captured.
  • Start Offset:This is required if only part of the delimited value needs to be assigned to the parameter. It defines the starting position of the portion, which needs to be extracted. The offset value must be non-negative. It is enabled when From Beginning check box is disabled. If the Start Offset value is set to 5 then it truncates the first 5 characters and saves this altered data, starting from the 6th position to the last position, in the searched parameter variable. Save Offset value can lie in the range 0-100 (inclusive of boundaries). User can also specify whether to consider a complete length or a specified length.
  • Maximum Length:The length of a sub-string of the found value, from the specified offset, to search to the parameter. It is enabled when Till the end check box is disabled. If the Maximum Length value is set to 5 then it truncates the last 5 characters and saves this altered data, ending from the 6th position from the last position, in the searched parameter variable.
  • Transform: Specifies any built-in transforms, which need to be applied to the extracted value before it is assigned to the parameter. There are following options within this:
  • None:It represents the value as it is.
  • Reverse:It reverses the extracted value.
  • Upper Case:It transforms the extracted value in upper case.
  • Lower Case:It transforms the extracted value in lower case.
  • LTrim:It trims the white spaces (occurred at the left) from the extracted value.
  • RTrim:It trims the white spaces (occurred at the right) from the extracted value.
  • Trim:It trims the whitespaces (occurred at the left and right) from the extracted value.


Sample Request

  • Template Name: Here, user can view sample request content of any template by selecting it from a dropdown list.
  • Set Prefix: Clicking this button sets the prefix as selected in the sample request content.
  • Set Suffix: Clicking this button sets the suffix as selected in the sample request content.
  • Beautify: It is used for formatting or beautifying the sample requests and response templates in a well-structured format.

Request Parameter

Request parameters are used to hold the values for composing service responses. The values for a request parameter can be assigned from the HTML Form (input elements) coming in the request.

Steps to Add Request Parameter

Go to Parameters Settings menu > Add Parameters > Request Parameter. The Add Request Parameter window is displayed.

Figure 127: Add Request Parameter

Following are the specification of request parameter:

  • Attribute Name: Attribute name for which the parameter is defined. This is the name of Form element coming in request. For example, to get the value of Request parameter ‘shipping Method’ from request:

POST /checkout/shippingpayment?event=selectShippingMethod HTTP/1.1

Host: 11.16.152.115:3894

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.24) Gecko/20111103

Content-Type: application/x-www-form-urlencoded; charset=UTF-8

Content-Length: 16

Origin: https://localhost:9773

shippingMethod=US

Then, Attribute Name is ‘shippingMethod’ and its value is ‘US’.

Note: On selecting the ‘Parameter name is same as attribute name’ check box, the parameter name is considered same as the attribute name.

  • Parameter Name: Name of parameter to be associated with an attribute name. This name must be unique among all parameters in the service. Example: “UserId”.
  • Occurrence Count: This property is used when the source value of a Request parameter can occur multiple times in a request. It indicates which instance of the value should be extracted. The default index is 1. Select one of following:
  • Index: By selecting this, the user can define which index of occurrence need to be picked.
  • All: If user selects this option, then system takes all occurrence of the specified node.
  • Any: If this option is selected, then system takes any random occurrence of the specified node.
  • Start offset: This is required if only part of the delimited value needs to be assigned to the parameter. The offset value must be non-negative. Only numbers are allowed and there is no limit. It defines the starting position of the portion, which needs to be extracted means from where value of variable is started. It is enabled when from Beginning check box is disabled. If the Start Offset value is set to 5 then it truncates the first 5 characters and saves this altered data, starting from the 6th position to the last position, in the searched parameter variable. Save Offset value can lie in the range 0-100 (inclusive of boundaries). User can also specify whether to consider a complete length or a specified length.
  • Maximum length: Maximum length of the attribute value to be saved. A default value for the variable is 0. If the value is 0, then save complete attribute value. It is enabled when Till the end check box is disabled. If the Maximum Length value is set to 5 then it truncates the last 5 characters and saves this altered data, ending from the 6th position from the last position, in the searched parameter variable.
  • Action on not found: This action is taken if cookie name is not found in the HTTP request. No cookie value can be empty which a found case is. It has following two options:
  • Do not log message: It will not log any message.
  • Log Message: It will log all the message in the error logs.
  • Default value: Default value of request parameter if attribute is not found in the request. It can be empty.
  • Transform: Specifies any built-in transforms which need to be applied to the attribute value before it is assigned to the parameter. This is done after Decode, if decoding is to be done.
    • Reverse: String fetched from request is reversed in the response file.
    • None: No transformation is done.
  • Encode in response Template: To encode request parameter if used in the response template.
    • Do not encode: No need to encode value in response template
    • Encode all characters: Encode all character of value in response template
    • Encode specified characters: Encode only specified characters of value.
  • Decode Attribute Value: To decode or not decode the attribute value.
    • Decode: To decode when attribute value is extracted from the HTTP request. Decoding is done for URL style encoded value of the attribute. Example: %3D decode into =.
    • Do not Decode: The value is not decoded when it is extracted from the HTTP request.

SQL Query Parameter

SQL parameters are used to hold the values for composing service response, template selection and data selection, parameterized SQL provides robust handling and escaping of user input, preventing accidental exposure of data.

Steps to Add SQL Query Parameter

Go to Parameter Settings menu > Add Parameter > SQL Query Parameter. The Add URL Query Parameter window is displayed.

Figure 128: Add SQL Query Parameter

Following are the specification of Query parameter:

  • Query: Query is a question which is communicated formally. It can either be a select query or an action query, for e.g. select name, price, size, id from items_table where skuid=S80 and price >= 1000.

Ex: *select sid, browserplugins, bpcompleted, bpabandoned, channel, trnum from rumsessiontable_master where ordertotal={ordertotal};

Types of Queries:

  • Select Query: It is used to fetch the data from the database table in a tabular format.
  • Action Query: It is used to ADD, CHANGE, or DELETE multiple records at a time. Types of action queries are as follows:
  • Append Query: It takes the set consequences of a query and adds them to a current table.
  • Delete Query: It erases all records in a hidden table from the set results of a query.
  • Make Table Query: It makes a table depending on the set consequences of a query.
  • Update Query: It is used to modify the existing records in a table.
  • Parameter Name: Parameter names are fields of values which are generated automatically while passing a query.

Ex: sid, browserplugins, bpcompleted, bpabandoned, channel, trnum.

 

  • Occurrence Count: Occurrence count is the number of times a query has occurred.
  • Any: In any, it declares any of the queries based on the given search.
  • All: In all, it declares all the queries of the given search.
  • Specified: In specified, it declares only the specific queries of the given search.
  • Existing DSN: It is the DSN which is already present in the system.
  • New DSN: If a user wants to create a new DSN, he can click on the radio button “New DSN”. Once the user clicks on New DSN, user needs to enter the following details:

DSN Details

  • Data Source Name: It is used to store information for establishing a connection to a database on a remote database server. A DNS is the saved collection of settings required to connect to an ODBC data source.
  • Host: It is used for accessing locally/remote.
  • Port: It is the listening port/default port for SQL Server.
  • Username: It is the username of the database.
  • Password: It is the password for the particular user.
  • Database: It is the name of the databases of DSN such as: Postgres,MySQL,Oracle,SQL
  • DB Schema: It defines how data is organized within a relational database such as: Table Names, Fields, Data Types, and the relationships between these entities.
  • Test DB Connection: It is used to test connection with the database.

Note: Types of query can be Select Query and Action Query.

URL Query Parameter

URL Query parameters are used to hold the values for composing service responses. The value for a URL Query parameter can be assigned from the query string of URL of incoming service requests.

Steps to Add URL Query Parameter

Go to Parameter Settings menu > Add Parameter > URL Query Parameter. The Add URL Query Parameter window is displayed.

Figure 129: Add URL Query Parameter

Following are the specification of Query parameter:

  • Query Name: Name of the parameter in the query string of a URL.

For example, if user needs the value of URL Query parameter ‘Address’ from URL
http://www.abc.com/index.jsp?Name=cavisson&Address=US, then Query Name is ‘Address’ and ‘US’ is its value.

  • Parameter Name: If the Query name is same as the parameter name, then the user has to enable the Parameter name is same as the query name check box.
  • Occurrence Count: This property is used when the source value of a Request parameter can occur multiple times in a request. It indicates which instance of the value should be extracted. The default index is 1. Select one of following:
    • Index: Particular instance
    • All: All occurrences
    • Any: Randomly select one of the occurrence.

  

  • Conversion: This field is used to specify the conversion – none/encode/decode. The conversions are as follows:
  • None: This option will disable the conversion process.
  • Decode: This option is used to decode the encrypted conversion.
  • Encode: This option is used to send the data in an encrypted format.

Scratch Parameter

Scratch parameters (also called declare parameters) are used to set values in call back methods. These parameters are declared and then used in response and/or conditions.

Steps to Add Scratch Parameter

Go to Parameter Settings menu > Add Parameters > Scratch Parameter. The Add Scratch Parameter window is displayed.

Figure 130: Add Scratch Parameter

Following are the specifications of scratch parameter:

  • Parameter Name: Unique name for this parameter.
  • Default Value: If nothing comes in scratch parameter value then default value comes in place of parameter name in response.

Scratch Array Parameter

Scratch array variable is used to declare a variable and its size. Sometimes, multiple scratch parameters are required to store multiple parameter values. So, for this, scratch array parameter is used.

Steps to Add Scratch Array Parameter

Go to Parameter Settings menu > Add Parameters > Scratch Array Parameter. The Add Scratch Array Parameter window is displayed.

Figure 131: Add Scratch Array Parameter

Following are the specifications of scratch array parameter:

  • Parameter Name: Unique name for this parameter. Parameter name must be start with Alpha.
  • Size: Size is used to set the size of Scratch Array Parameter.
  • Default Value: If nothing comes in scratch parameter value then default value comes in place of parameter name in response.

Dataset Parameter

Datasets are used to source the values from text files. This is a very common method for getting data by instructing Service Virtualization to take values from an external file. Data is contained in a file – either an existing file or one that user created using this GUI. In Datasets multiple set names can be defined separated by “,”.

Steps to Add Dataset Parameter

Go to Parameter Settings menu > Add Parameters > Dataset Parameter. The Add Dataset Parameter window is displayed.

Figure 132: Add Dataset Parameter

Following are the specification of Dataset parameter:

  • Parameter Name(s): Unique name for this parameter. Multiple parameter names can be provided at the same time using comma as separator to populate multiple parameters with values from the Dataset. For example: Name, Address.
  • Header Line Number: In some situations, consider first few lines as headers. System does not consider these lines as data lines while picking data from file. By default, header line is 0.
  • Column Delimiter: This field specifies which character in data file should be considered as column separator. By default, column delimiter is ‘,’. User can use special symbols as column delimiter.
  • First Data Line: In some situations, user might want to start reading data from a particular line number. Therefore, they can use this field to indicate which line it should consider as first Data Line. By default, first Data Line is 1.
  • Fetch Parameters from Header: It is to get the parameter names from header line of dataset contents by splitting it by Column Delimiter. User defines header line in text box for e.g. if header line is Name, AccountNo, CreditCardNo, Balance and column delimiter is “,” then parameters names is Name, AccountNo, CreditCardNo and Balance.
  • Dataset File Name: It is data file name from where the values need to take. Files with spaces in its name are not supported.
  • Dataset Contents: Contents can be any combination of characters, numbers, special characters are also allowed. These contents can get from existing file from the server by specifying Dataset File name and click on View. User can also write in to this and upload it using Upload

Advanced Settings

  • Ignore Invalid Data Lines: Selecting this check box provides user the flexibility to ignore the invalid lines present in the file or to have an error in case of invalid line.
  • Update Value On: There are two modes available:
  • SESSION, value of the variable is initialized only once during a session at the time of first use & is not changed during the session. Means the parameter is set once for each service request. It does not depend on how many times this parameter is used in response template.
  • USE, in this option value of the parameter is set every time it is used in the response template.
  • Row Selection Mode: there are 2-modes are available
  • Sequential: – Select rows sequentially from the beginning of file to the end of file.
  • Random: – Select any row randomly from the file.
Figure 133: Advanced Settings(Dataset Parameter)
  • Parameter fields whose value is from file: In this field, multiple parameter values can be provided.

e.g. (Fn=<value> or<filename>)

Where n specifies the index number to refer the parameter name, default value for parameter values is value.

Example: If dataset contents are:

/home/Service Virtualization/user1, LA

/home/Service Virtualization/user2, CA

/home/Service Virtualization/user3, NY

In parameter value, user provides F1=file, F2=value. It means first parameter value comes from file which is specified in first field and second parameter value is as specified in the second field. File can have any data (one or many lines) and the whole file content is the value of the first field. It is useful when parameter value can have multiple data lines or its data can have the file separator for example address. 

Notes:

  • A user cannot save a blank file or provide blank dataset contents. While doing so, an error message “Please enter dataset content” is displayed.
  • FILE is a mandatory argument and data-file-name specifies the file name containing the list of values for the variable(s) being declared. Format of the value file is as follows:
    • If there is only one variable being defined in the declaration, the file contains list of values with one value on a single line.
    • If multiple variables are being defined, a value of all variables would be defined on a single line and the values would be separated by “,”. Effectively, each row contains a set of values for each variable declared. The order of values in a row should correspond to order of variable names in the declaration.
    • If the file name is a relative path (not starting with /), it is assumed relative to service directory of the test script to which these variables belong.

 

 

Indexed Dataset Parameter

Indexed Dataset Parameters are specialized Dataset parameters where values provided in data files can be selected based on an index value. The index can be assigned from any other parameter e.g. a customer id from an incoming request can be used to select a row of values in data file for discount codes. In Indexed Dataset parameters multiple parameter names can be defined separated by “,”. 

Steps to Add Indexed Dataset Parameter

Go to Parameter Settings menu > Add Parameters > Indexed Dataset Parameter . The Add Indexed Dataset Parameter window is displayed.

Figure 134: Add Index Dataset Parameter

Following are the properties of Indexed Dataset parameter:

  • Index Parameter: Its value specifies the value of indexed dataset parameter.
  • Parameter Name(s): It should start with a character, next user can use Numbers, and underscore is also allowed. Max length of parameter name should be of 64 characters. Multiple parameter names can be provided at the same time, separated by a comma.
  • Header Line Number: In some situations, consider first few lines as headers. System does not consider these lines as data lines while picking data from file. By default, header line is 0.
  • Column Delimiter: This field specifies which character in data file should be considered as column separator. By default, column delimiter is ‘,’. User can use special symbols as column delimiter.
  • First Data Line: In some situations, user might want to start reading data from a particular line number. So, they can use this field to indicate which line it should consider as first Data Line. By default, first Data Line is 1.
  • Fetch Parameters From Header: It is to get the parameter names from header line of index dataset contents by splitting it by Column Delimiter. User defines header line in text box.
    Example: If header line is Name, AccountNo, CreditCardNo, Balance and column delimiter is “,” then parameters names is Name, AccountNo, CreditCardNo and Balance.
  • Index Dataset File Name: It is data file name from where the values need to take. Files with spaces in its name are not supported.
  • View: Click to view the Indexed Dataset File name
  • Choose: Click this button to choose Indexed dataset file from local directory.
  • Import: In Import from database, user have the following fields:
Figure 135: Import From Database

Fill the following fields to import:

  • Database Type: Select the database type to be imported.
  • URL Prefix: Enter the prefix to be entered before the URL.
  • URL: From where the database is to be imported.
  • User ID: Enter the User ID of the database.
  • Password: It is the password of the user.
  • Query: In this field, the user has to provide the query of importing the data from the Database.
    • Index Dataset Contents: Contents can be any combination of characters, numbers, special characters are also allowed. These contents can be loaded from an existing file from the server by specifying Dataset File name and clicking on View. User can also enter data in this field and upload it using Upload
    • Table Format: By applying this checkbox, Index dataset content can be viewed in table format.

Advanced Settings

  • Ignore Invalid Data Lines: Selecting this check box provides user the flexibility to ignore the invalid lines present in the file or to have an error in case of invalid line.
  • Default values if index parameter value is not found: If no value matches in file regarding the index value comes in request then default value serves for index parameter.
  • Parameter fields whose value is from file: In this field, multiple parameter values can be provided.

e.g. (Fn=<value> or<filename>)

Where n specifies the index number to refer the parameter name, default value for parameter values is value.

Example: If indexed dataset contents are
001/home/Service Virtualization/user1,LA
002/home/Service Virtualization/user2,CA
003/home/Service Virtualization/user3,NY
In parameter value, user provides F1=file,F2=value it means first parameter value comes from file path which is specified in content and second parameter value is itself. (LA/CA/NY).

Figure 136: Advanced Settings(Index Dataset)

Note: A user cannot save a blank file or provide blank dataset contents. While doing so, an error message “Please enter dataset content” is displayed.

Date/Time Parameter

Date/Time replaces the parameter with the current date and/or time. To specify a date/time format, user can select a format from the format list or specify his/her own format.

Steps to Add Date/Time Parameter

Go to Parameters Settings menu > Add Parameter > Date Time Parameter. The Add Date/Time Parameter window is displayed.

Figure 137: Date/Time Parameter

Following are the properties of Date/Time parameter:

  • Parameter Name: This value must begin with a character. Numbers or underscores can be used for the rest of the name. Max length can be 64 characters.
  • Format: Defines the format of date/time by selecting one from the available list of formats.
  • Sample (Current Date/Time): Displays the current date and time of system in selected format.
  • Offset: Offset in days from current day. It can be 0, positive number or negative number. If its value is positive, then it adds the number of days to the current day and use that date. If offset is negative, then the value of the parameter is offset number of days before to the current date.
  • Update Value On: This property has two options:
  • SESSION – Value of the parameter is initialized only once during a session at the time of first use and is not changed during the session. This means the parameter is set once for each service request. It does not depend on how many times this parameter is used in response template.
  • USE – Value of the parameter is set every time it is used in the response template.

Random Number Parameter

Random Number replaces the parameter with a random number. User can set a range of numbers by specifying minimum and maximum values. They can use the Random Number parameter type to sample the system’s behavior within a possible range of values.

Steps to Add Random Number Parameter

Go to Parameters Settings menu > Add Parameter > Random Number Parameter .The Add Random Number Parameter window is displayed.

Figure 138: Random Number Parameter

Following are the properties of random number parameter:

  • Parameter Name: Its value should be started with a character. Further number, underscore can also be used. Max length should be of 64 character.
  • Minimum: It is the minimum number of digits used for range, should be number only. There is no limit of minimum number of digit.
  • Maximum: The maximum number of digits used for range. No limit for maximum number of digits.
  • Format: Select a number format, indicating the length of the random number. Specify (%01lu or %lu) for one digit, %02lu for two digits, and so on.
  • Update Value On: This property has two options:
  • Session – Value of the variable is initialized only once during a session at the time of first use & is not changed during the session. Means the parameter is set once for each service request. It does not depend on how many times this parameter is used in response template.
  • Use – Value of the parameter is set every time it is used in the response template.

Random String Parameter

Random String replaces the parameter with a random string. User can set a range for number of characters in string by specifying minimum and maximum values. They can use the Random String parameter type to sample the system’s behavior within a possible range of values.

Steps to Add Random String Parameter

Go to Parameters Settings menu > Add Parameter > Random String Parameter. The Add Random String Parameter window is displayed.  

Figure 139: Random String Parameter

Following are the properties of random String parameter:

  • Parameter Name: It defines the name of the parameter. User can use the Random String parameter type to sample the system’s behavior within a possible range of values.
  • Minimum: It defines the minimum number of characters used in Random String
  • Maximum: It defines the maximum number of characters used in Random String.
  • Character Set: It is to define characters to be used in Random String. Characters can be defined either individually i.e. age or range i.e. A-Z. Accepted character set are (a-z, A-Z, 0-9)
  • Update Value On: This property has two options:
  • Session – Value of the variable is initialized only once during a session at the time of first use & is not changed during the session. Means the parameter is set once for each service request. It does not depend on how many times this parameter is used in response template.
  • Use – Value of the parameter is set every time it is used in the response template.

Unique Number Parameter

Unique Number replaces the parameter with a unique number.

Steps to Add Unique Number Parameter

Go to Parameters Settings menu > Add Parameters > Unique Number Parameter. The Add Unique Number Parameter window is displayed.

Figure 140: Add Unique Number Parameter

Following are the properties of random String parameter:

  • Parameter Name: Its value should be started with a char. Further number, underscore can also be used. Max length should be of 64 char.
  • Format: It defines the format of unique number to be generated. Different formats are available in list. If user selects %03lu, it means random number should be of 3 digits, if number is of 2 digits then automatically in place of remaining digits ‘0’ be used.
  • Update Value On: This property has two options:
  • Session – Value of the variable is initialized only once during a session at the time of first use & is not changed during the session. Means the parameter is set once for each service request. It does not depend on how many times this parameter is used in response template.
  • Use – Value of the parameter is set every time it is used in the response template.

 

Cookie Parameter

Cookie parameters are used to hold the values for composing service responses. The values for a cookie parameter can be assigned from the cookie coming in the request.

Steps to Add Cookie Parameter

Go to Parameters Settings menu > Add Parameters > Cookie Parameter. The Add Cookie Parameter window is displayed.

Figure 141: Add Cookie Parameter

Following are the properties of Cookie parameter:

  • Cookie Name: Cookie name for which the parameter is defined. It is optional. If not passed, then cookie name is same as cookie parameter name. More than one parameter can be defined for one cookie. This has meaning if user needs to apply different save offset, transformation etc. to get different values in different parameters.
  • Parameter Name: Name of parameter to be associated with a cookie. This name must be unique among all parameters in the service. It must start with an alphabet and after alphabet, user can use number and underscore. Maximum length should be of 64 characters. Example JSessionIdVar.
  • Start Offset: This is required if only part of the cookie value needs to be assigned to the parameter. The offset value must be non-negative. Only numbers are allowed and there is no limit. It defines the starting position of the portion which needs to be extracted means from where value of variable is started. Offset can have any value >= 0;

0 indicates save from beginning of value. (Default)

       > 0 indicates save after this offset (Offset 0 mean 1st character)

It is enabled when From Beginning check box is disabled. If the Start Offset value is set to 5 then it truncates the first 5 characters and saves this altered data, starting from the 6th position to the last position, in the searched parameter variable. Save Offset value can lie in the range 0-100 (inclusive of boundaries). User can also specify whether to consider a complete length or a specified length.

  • Maximum Length: Maximum length of the cookie value to be saved. It must be >= 0. 0 indicates that save complete cookie value. (Default).  >0 indicates save up to this length. It is enabled when Till the end check box is disabled. If the Maximum Length value is set to 5 then it truncates the last 5 characters and saves this altered data, ending from the 6th position from the last position, in the searched parameter variable.

Note: User will also get the option to select the checkbox, if they want the maximum length to be till the end.

  • Decode Cookie value: To decode when cookie value is extracted from the HTTP request. Decoding is done for URL style encoded value of the cookie. Value is not case sensitive.
    • Decode – value is decoded before saving in the parameter.
  • Do not decode – not decoded
  • Transform: Specifies any built-in transforms, which need to be applied to the cookie value before it is assigned to the parameter. This is done after Decode if decoding is to be done.
  • Reverse: If user uses reverse, then string fetched from request is reversed in the response file.
  • None: No transformation is done. It displays string as it is without any modification.
  • Encode in response template: To encode cookie parameter if used in the response template. Value is not case sensitive.
  • None – No need to encode value in response template.
  • All – Encode all character of value in response template.
  • Specified – Encode only specified characters of value as defined by SpecifiedChars argument. Special characters to be encoded.
  • Action On Not Found: The action to be taken if cookie name is not found in the HTTP request. No cookie value can be empty which a found case is.
  • Do not log message – Do not log message.
  • Log message: Log message (Message is logged in error log).
  • Default Value: Default value of cookie parameter if cookie is not found in the request. It can be empty. By default, it is empty.

 

 

XML Parameter

User can use an XML type parameter to replace the entire structure with a single parameter. Any pattern which is appearing within XML Node path would be used for initializing the value of the XML parameter. It is useful for web services.

 

Steps to Add XML Parameter

Go to Parameters Settings menu > Add Parameter > XML Parameter .The Add XML Parameter window is displayed.

Figure 142: Add XML Parameter

Following are the properties of XML parameter:

  • Parameter name: This is the name of XML variable being defined. It’s a mandatory field. This name must be unique among all parameters in the service. It must start with an alphabet and after alphabet, user can use number and underscore also. Maximum length should be of 64 characters.
  • XML Node Path: Specify the full path of the node for which the user needs to fetch the value. For example, in below XML, user needs to get the value of node referringId then XML Node Path should be as follows:

<soapenv:Envelope>
<soapenv:Body><prepareOrder><in ><header><referringId>. Complete path of any node can be set using “Set XML Node Path” button that is explained below.
<soapenv:Envelope xmlns:soapenv=”http:////schemas.xmlsoap.org/soap/envelope/”>
  <soapenv:Body>
    <prepareOrder xmlns=”http://www.mst.macys.com/xsd/order”>
      <in>
         <header xmlns=””>
            <referringId>271</referringId>
            <partnerOrderId>2159013153</partnerOrderId>
         </header>
      </in>
    </prepareOrder>
  </soapenv:Body>
</soapenv:Envelope>

 

  • Occurrence Count: It is required if multiple occurrence found of specified node. User has three options for this.
  • Index: By selecting this user can define which index of occurrence need to pick.
  • All: If user selects this option then system takes all occurrence of the specified node.
  • Any: It takes randomly any one occurrence out of all.
  • Conversion: This option is used to encode search pattern. It has three options.
  • None: In this option, no encoding is applied.
  • HTMLToURL: It converts HTML-encoded data to a URL-encoded data.
  • Value Type: It specifies that the value of parameter is node value or attribute value. It has two options.
  • Node Value: In this options system gets the value of node. For   example if XML Node Path is <soapenv:Envelope><soapenv:Body>
    <in><header><referringId> with ‘Node Value’ option then it gets the value 271.
  • Attribute Value: In this option, system asks for the attribute name and get the value of specified attribute. For example if XML Node Path is <soapenv:Envelope><soapenv:Body><prepareOrder> with   ‘Attribute Value’ option and Attribute name is ‘xmlns’ then it gets  the value “http://www.mst.abc.com/xsd/order”.
  • Node selection criteria (Where Clause): Argument specifies the qualifiers/clauses. These are particularly useful when NODE occurs multiple times but may also be used to make sure that Node value is assigned only when certain condition is matched. When multiple WHERE arguments are present, all WHERE qualifiers/clauses should be satisfied WHERE argument has the form WHERE=type=value.

Two options are applicable for where clause

  • None: Nothing to node selection criteria.
  • Specified: Type can take following forms:

Node value like Natraj i.e.: WHERE=<>=”Natraj” Attribute, attribute name in angular braces specify the attribute value. Value should be specified in double quotes. If the values contain a double quote (“).

  • Sample Request for Template Name: Here user can view sample request contents of any template by selecting in to a dropdown. We are displaying the sample request here to help user to specify the node/attribute.
  • Set XML Node Path: This button is to help user to get the complete path of the node and set in to XML Node Path by selecting any node. For example if user selects ‘partnerOrderId’ node and clicks on this button then complete path of this node ‘<soapenv:Envelope><soapenv:Body><prepareOrder><in><header>
    <referringId>’ is automatically set in to XML Node Path.
  • Set Attribute Name: This button is to set the attribute name by selecting it in the sample request content.
  • Auto Wrap: It wraps the sample request data of template automatically. This feature is used for formatting purpose only.
  • Beautify: It is used for formatting or beautifying the sample requests and response templates in a well-structured format.

 

 

Conditional Logic

Conditional logic feature can be used to define the value of any parameter by any defined condition. It can have multiple conditions using ‘If’ and ‘Else If’

Steps to conditional assignment of Parameter value

Go to Parameters Settings menu > Add Parameters > Conditional Logic .The Conditional Logic window is displayed.

Figure 143: Add Conditional Logic

Following are the properties of conditional logic:

  • Condition: First add If or Else If or Else from this list then all other values is enabled. Condition can be added by clicking on Add Once any condition is added then it is disabled until other things added like Expression and Set Parameter.
  • Select Expression: This section is to define the expression for condition. Expression can be any parameter value equals to/not equals to any other parameter value. Expression can also be compare between any parameter values with any constant defined value.
  • Logical Operator: Multiple conditions also can apply using logical operator between them.
  • AND: If AND operator is there in-between two conditions then whole condition is satisfied only when both condition is satisfied.
  • OR: If OR operator is there in-between two conditions then whole condition is satisfied when any condition is satisfied.
  • Set Parameter: This section is to define that value of which parameter is going to set through this condition. Value of parameter can be from these options.
  • Constant: Here the value of parameter is a defined constant value.
  • System Parameters: In this option, system provides a dropdown which contains all system variables. System variables are pre-defined variables and bundled with Service Virtualization product.
  • Other Parameter: In this option, system provides a dropdown list which contains already created parameters in the service.
  • Random Value: In this option, system takes a range from and to. System picks a random number from this range and set this to parameter.
  • Unique: In this option, system generates a unique number to set as parameter value.
  • Random Value from List: In this option, user can define multiple values separated by “,”. System takes any value randomly out of them.
  • Add: This button adds the selected section in Logical Block
  • Reset: It resets all values
  • Logical Block: It contains the final output of conditional logic which is going to be applied.

Example:

If

    userID = “34567334”

    OR

    userID = “98273621”

    Set cardNo = “7268898672”

Else If

    userID = “29384743”

    Set userID = Random(2000000000,2500000000)

Else

    Set userID = Unique()

JSON Parameter

JSON variables are initialized as a result of searching a request for user specified criteria. Any pattern appearing within the JSON node would be used to initialize the value of JSON NO variable.

Steps to Add JSON Parameter:

Click Parameter Settings > Add Parameters > Json Parameter. The Add Json Parameter window is displayed.

Figure 144: Add Json Parameter
Figure 145: Sample Request

Following are the properties of JSON parameter:

  • Parameter name: This is the name of JSON variable being defined. It’s a mandatory field. This name must be unique among all parameters in the service. It must start with an alphabet and after alphabet, user can use number and underscore. Maximum length should be of 64 characters.
  • Object Path: Specify the full path of the node for which the user needs to fetch value. For example, in below JSON, user needs to get the value of node email then JSON Node Path should be “root.email”.

Note: JSON path should start with “root.”.

Request of JSON:-

“expand” : “attributes”,

“link” : {

“rel” : “self”,

“href” : “http://localhost:8095/crowd/rest/usermanagement/1/user?username=my_username”

},

“name” : “my_username”,

“first-name” : “My”,

“last-name” : “Username”,

“display-name” : “My Username”,

“email” : “user@example.test”,

“password” : {

“link” : {

“rel” : “edit”,

“href” : “http://localhost:8095/crowd/rest/usermanagement/1/user/password?username=my_username”

}

},

“active” : true,

“attributes” : {

“link” : {

“rel” : “self”,

“href” : “http://localhost:8095/crowd/rest/usermanagement/1/user/attribute?username=my_username”

},

“attributes” : []

}

}

  • Occurrence Count: It is required if multiple occurrence found of specified node. User has three options for this.
  • Index: By selecting this user can define which index of occurrence need to pick.
  • All: If user selects this option then system takes all occurrence of the specified node.
  • Any: It takes randomly any one occurrence out of all.
  • Start Offset: If the pattern searched by Service Virtualization is of length 20 but suppose the requirement is to pick data from the 5th In this case, Start Offset can be used. It is enabled when From Beginning check box is disabled. If the Start Offset value is set to 5 then it truncates the first 5 characters and saves this altered data, starting from the 6th position to the last position, in the searched parameter variable. Save Offset value can lie in the range 0-100 (inclusive of boundaries). User can also specify whether to consider a complete length or a specified length.
  • Maximum Length: If the pattern searched by Service Virtualization is of length, say, 20 but suppose the requirement is to pick data till the 4th last position. In this case, Maximum length can be used. It is enabled when Till the end check box is disabled. If the Maximum Length value is set to 5 then it truncates the last 5 characters and saves this altered data, ending from the 6th position from the last position, in the searched parameter variable.
  • Conversion: This option is used to encode search pattern. It has three options.
  • None: In this option, no encoding is applied.
  • HTMLToURL: It converts HTML-encoded data to a URL-encoded data.
  • HTMLToText: It converts HTML-encoded data to plain text format.
  • TextToUrl: It converts TEXT-encoded data to URL format.
  • UrlToText: It converts URL-encoded data to plain text format.
  • UrlToHtml: It converts URL-encoded data to HTML text format.
  • TextToHtml: It converts Text data to HTML text format.
  • TextToBase64: It converts Text data to Base64 format.
  • Base64ToText: It converts Base64 data to Text format.
  • Encoding Options: Encoding is used to encode special characters to their ASCII Users can encode any number of special characters i.e. all, specific or none. User can have the following options:
  • Encode all special characters except (+), (-), (.), (_): All special symbols except + – . _ are encoded. It is the default value.
  • Encode only specified characters: The user can specify which special characters to encode in Characters to encode
  • Do not encode special characters: None of the special characters is encoded. However, space is encoded always.
  • Character to Encode: This option will be enable in case of Encode only Specified Character option. In this filed, the user has to provide the character to be encoded.
  • Encode Space By: This option specifies to Service Virtualization how to encode Space. User can have two options: ‘+’ or ‘%20’. If ‘+’ is chosen, Service Virtualization encodes Space by ‘+’ and if ‘%20’ is chosen, Service Virtualization encodes Space by ‘%20’. The default value is ‘+’.
  • Sample Request for Template Name: Here user can view sample request contents of any template by selecting in to a dropdown. We are displaying the sample request here to help user to specify the node/attribute.
  • Set JSON Node Path: This button is to help user to get the complete path of the node and set in to Object Path by selecting any node.
  • Beautify: It is used for formatting or beautifying the sample requests and response templates in a well-structured format.

 

 

 

Service Settings

HTTP Headers

Service Virtualization sends following headers in the service response:

  • Content-Length
  • Content-Type – If content type was selected for the template.
  • Any additional header specified in global header files.
  • Any header added using C API used in the callback methods.

Using HTTP header setting, user can send additional HTTP headers in the response for the service.

Steps to add HTTP headers

To access this option click on  the Service Settings  icon and select HTTP Headers as shown in below figure.

Figure 146: HTTP Headers

Once user click the option, they have the window as per the below picture.

Figure 147: HTTP Headers

Note:

  • ‘Template Based Headers’ has higher priority than ‘Service Based Headers’.(Example:- ‘Service Based Headers’ will be overridden if ‘Template Based Headers’ is defined in that Service.)
  • Template based ‘Content type header’ has higher priority than Service based ‘Content type header’.
  1. Enter the header name and press enter.
Figure 148: Add Header

2. Click Add button to add headers.

HTTP Settings

This allows user to use HTTP settings, such as keep alive time and decode request content settings. It also provides provision to configure mock response details, content length indicator, and date header. To access this option click on  the Service Settings  icon and select HTTP Settings as shown in below figure.

Figure 149: HTTP Settings

Following are the fields in HTTP Settings:

  • Decode Payload Content: This option is to identify whether the contents of request are in encoded form or not.
  • If option “No” is selected, then system will not decode the request contents.
  • If option “Yes” is selected, then system will always decode the request contents.
  • Keep Alive Timeout: This setting prevents unused connections from hanging around for too long. It sets how long the server should wait for new requests from clients. Default HPD Keep Alive Connection Timeout is 450 secs.
  • Compressor Type: This is to enable the different types of ‘Content-Encoding’ header in http response like gzip, deflate, and Br. The response will also be compressed.
  • Mock Response Details: In mock response section, user can configure the percentage of the selected HTTP Status code to be reflected in the response of the service.
Figure 150: Mock Response Details
  • Content Length Indicator: Content Length Indicator allows to transfer data into a series of overlapping chunks. Once the user select the Enable Content Length Indicator check box, more options are displayed in the below format.
Figure 151: Content Length Indicator

User can choose from two options in the Chunk Scheme drop-down: Size of chunk and Number of chunks. For details refer to Template based Content Length Indicator.

The check box for Default size of chunk/Default number of chunks is selected by default. User must clear the check box to enter a value other than the default value.

Date Header: Date header is used to display the current date and time in the response template. Once user enable this check box, the current date and time is appended in the response.

Figure 152: Data Header

Service Time Delay

Service Virtualization sends response of the service as soon as the request is received. So, there is no delay in the Response. User can add service time delay by using Service Time Delay settings.

To access this option click on  the Service Settings  icon and select Service Time Delay as shown in below figure.

Once the above option is selected, a new window opens as shown in figure below.

Figure 154: Service Time Delay Open API

Service time delay settings have following fields:

  • Overwrite Global Service Time Delay: Select this check box to enable service time and proceed further. In overwrite global service time delay, there are following two options:
    • No service time: No service time used.
    • Exponential Random service time with median of: For exponential random distribution, median is roughly around ¼th of mean. The service time is taken in milliseconds (ms).
    • Constant service time: This property is used to provide constant service time. The constant service time is taken in milliseconds (ms).
    • Random (Uniform distribution) service time: This property is used for uniform distributions service time. The random service time is taken in milliseconds (ms).

 

 

Trace Level

Service Virtualization logs important messages. These logs are called traces.  To access the Trace level, click on  the Service Settings  icon and select Trace Level as shown in below figure.

Figure 155: Trace Level Option

Once user click the option, the below figure appears.

Figure 156: Trace Level Open API
  • Disabled: No logs.
  • It will log request URL with parameter details like parameter name and its value.
  • It will log request URL with parameter details like parameter name and its value, Request/response.

Comments

Using Comments, user can add comments to the service for his/her own reference. For example, design notes, modifications – any user-defined comments.

To access the Trace level, click on  the Service Settings  icon and select Comments as shown in below figure.

Figure 157: Comments Option

Once user click the option, following page appears.

Figure 158: Comments

Call back

User can use Service Callbacks to add own custom scripts using C language based callback methods. To access the Trace level, click on  the Service Settings  icon and select Callback as shown in below figure.

Figure 159: Call Back option

 There are two types of callbacks:

  • Use On Request Method: This method is called on receiving the service request and after all search and conditional parameters are processed and before applying service delay time.
  • Use After Request Method: This method is called just before sending the response of the service.
  • Use External Library: Select this check box and then either select library from the drop-down list or upload it from system.
Figure 160: Call Back

Following is the template of On Request callback method user can use:

#include <stdio.h>

#include <time.h>

#include <stdlib.h>

#include <string.h>

#include “/var/www/Service Virtualization Server/include/Service Virtualization Server_log.h”

#include “/var/www/Service Virtualization Server/include/Service Virtualization Server_string_api.h”

#include <errno.h>

#include <unistd.h>

 

/*——————————————-

  Name: MyService_on_request_callback

  Purpose: This method is called on receiving the service request and after all search and conditional parameters are processed and before applying service delay time.

  Input:   None

  Return:  The function controls service time. Return values can be:

           0 – No service delay time. Override service delay time configure if any

          -1 – Use service delay time as configured

          >0 – Use service delay time in milli-seconds returned by this method

 ————————————————*/

int MyService_on_request_callback()

{

 

   return –

 

Forward Settings

For forward settings details refer to Forward.

Figure 161: Forward Settings